Red Hat JBoss Fuse Integration Partner Day
Charles Moulliard (@cmoulliard)
Architect, Engineer & Committer
13th of May - 2014
A few things about Fuse & OpenSource
|
|
Producer sends messages to a queue (using JMS API).
Consumer listens for messages from the queue
Messages are stored until read (or expired)
Messages can be persisted, are read only once.
A client sends message to the topic.
Broker sends message to all subscribers that are currently alive.
Messages are consumed x times (relation 1 to many)
ActiveMQ project High performance, reliable JMS messaging fabric
Supporting JMS, C, C++, .Net, Stomp, AMQP clients
Protocols : TCP/SSL/HTTP/HTTPS/WebSocket …
High-Availability / Failover
Brokers compete to acquire lock - FS/DB
Forward messages
Loadbalancing, isolate brokers - security, …
An open source messaging platform
|
| |
|
OpenSource Java Integration Framework
Designed around : Domain Specific Language
Implement Enterprise Integration Patterns
> 50 patterns implemented
and more : Loadbalancer, Throttler, Delayer, …
|
Key features : route, processor
Interceptor : trace, log, capture business events
|
|
|
|
Data Transformation for complex use case
package org.devnation.camel;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.camel.Exchange;
public interface DataFormat {
void marshal(Exchange exchange, Object graph, OutputStream stream) throws Exception;
Object unmarshal(Exchange exchange, InputStream stream) throws Exception;
}Marshalling : Object XML (JAXB)
Unmarshalling : XML Object (JAXB)
Fluent API
package org.devnation.camel;
import org.apache.camel.builder.RouteBuilder;
public class ExampleRouteBuilder extends RouteBuilder {
@Override
public void configure() throws Exception {
from("amq:queue:quotes")
.filter().xpath("/quote/product/ = 'widget")
.bean("QuotesService", "widget")
.filter().xpath("/quote/product/ = 'gadget")
.bean("QuotesService","gadget");
}
}Alternative : Spring, Blueprint DSL
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
">
<bean id="quotesService" class="org.devnation.camel.QuotesService"/>"
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="amq:queue:quotes"/>
<filter>
<xpath>"/quote/product/ = 'widget"</xpath>
</filter>
<bean id="quotesService" method="widget"/>
<filter>
<xpath>"/quote/product/ = 'gadget"</xpath>
</filter>
<bean id="quotesService" method="gadget"/>
</route>
</camelContext>
</beans>In memory bus / alternative to JBI, SCA, NMR
Transport objects : XML, File, Stream, Bytes
Predicate & Expression language (xslt, xpath, …)
Sync/Async exchanges
Threads Management,
Tx Architecture
Error and exception handling
Policy driven
Container agnostic
Apache CXF Simplify creation & deployment of web/REST services
2 approaches “java wsdl” or “wsdl java”
Support :
JAX-WS : Web Services (XML/SOAP)
JAX-RS : REST service (JSON)
SOAP 1.1, 1.2, WSDL 1.1, WS-Security, WS-Addressing, WS-RM
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/resources/myService.wsdl</wsdl>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin><beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:cxf="http://camel.apache.org/schema/cxf"
...
<cxf:cxfEndpoint id="reportIncident"
address="http://localhost:{{port}}/camel-example/webservices/incident"
wsdlURL="etc/report_incident.wsdl"
serviceClass="org.apache.camel.example.ReportIncidentEndpoint"/>
...
<route>
<from uri="cxf:bean:reportIncident"/>
<convertBodyTo type="org.apache.camel.example.reportincident.InputReportIncident"/>
<transform>
<method bean="responseBean" method="getOK"/>
</transform>Enables integration everywhere for a real-time enterprise
Java OSGI Runtime
Offer modularity for Integration
Multi-Technology platform
Technology Camel, CXF, ActiveMQ, Spring, Fabric, …
Modular platform (deploy or remove container/libraries)
SSH server
Allow to administrate/create instances
Propose Provisioning solution features
Hot deployment
Configuration & Instances management
Security integration - JAAS
Karaf DEMO :
Admin
Provisioning
Hot Deployment
Camel routes isolated from each other (classloader)
Bundle CamelContext boundaries Local BUS
Camel routes can have different SLA (Threads, Policies, …)
Camel routes can be started/stopped/updated
Simplify maintenance process
New routes can be hot deployed
like also "Beans/POJO, Web Services, …"
How can I manage complex infrastructure (config, ip, …)
Combine Local/Remote/Virtual Machines/Iaas/Paas
Can we support other Java containers
Web/JavaEE/MicroContainer/Docker …
Opensource integration project - http://fabric8.io
Goals :
Configuring, provisioning & running Fuse on any machines physical, virtual, private, public, cloud …
Virtualize services (endpoints), processes
Propose ElasticSearch Storage engine (insight)
|
Fabric extend the possibilities
Management rely on Zookeeper server (ensemble of 1,3, 5 or servers)
& Fabric Agents
They will communicate with Zk server to :
register container info (ports, services, endpoints, processes)
get their provisioning
Provisioning = Behavior of a container, achieved with Profiles
Enveloppe(s) containing artifacts to be deployed or parameters to be configured
Can be versioned, facilitate mngt - rollback
Virtualization Create “indirection” points
Load balancing and failover
Easy elastic scaling of services
High-availability, Replication
Insight Technology
NoSQL storage for JSon documents
Designed around ElasticSearch
Dashboard
Full Text Search features
Collect
Logs,
Camel metrics,
JMX metrics,
Own data metrics
Create a bean recuperating Message/Exchange using @Header, @Body
Store it using org.fusesource.insight.storage.StorageService
import org.apache.camel.Header;
import org.fusesource.insight.storage.StorageService;
import java.sql.Timestamp;
import java.util.Date;
public class StoreService {
private static String ES_TYPE = "insight-tweet";
private static StorageService storageService;
public static void store(@Header("tweet-full") String data) {
storageService.store(ES_TYPE, generateTimeStamp(), data);
}
|
Projects timeline
High level presentation
Technology overview
Architectures design
Demos
The BUS operates the exchanges between the endpoints using Camel (local) or NMR (global)
Decoupling "services" from integration layer
Karaf runs Jetty Web Server
Web Project can be registered using OSGI HTTP Service
2 products JBoss Fuse & AMQ
Designed around Multi-Technology OSGI Container
Packaging of Open Sources projects :
Karaf,
Camel,
Cxf,
ActiveMQ,
Fabric8,
Hawtio
Apache Karaf | POJO + Messaging + Web |
Apache ActiveMQ | High Availability with Network of Brokers |
Fabric8 | Virtualization of Camel endpoints / loadbalancing |
|
More info
www.jboss.org/products/fuse.html
www.redhat.com/products/jbossenterprisemiddleware/fuse/